package com.wang.controller;

import com.aaa.entity.OPayLog;
import com.aaa.vo.Result;
import com.alipay.api.AlipayApiException;
import com.wang.config.PayConfig;
import com.wang.service.PayService;
import com.wang.vo.PayInfoVO;
import com.wang.vo.PayStatusVo;
import com.wang.vo.PayUtils;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;

/**
 * @author :  DongZheng Wang
 * @PROJECT_NAME: fifth-cai-parent
 * @date :  2023-03-07 14:57
 **/
@RestController

@RequestMapping("/order/order")
public class Pay {
    @Autowired
    @Qualifier("PayServiceImpl")
    private PayService payService;

    @ApiOperation("返回支付二维码和支付信息")
    @PostMapping("/buyCart")
    public Result getPayInfo(@RequestBody PayUtils payUtils) throws IOException {
        Result payInfo = payService.getPayInfo(payUtils);
        return new Result(2000,"支付成功", payInfo);
    }
    @RequestMapping("paystatus/{orderno}")
    public Result paystatus(@PathVariable String orderno) throws AlipayApiException {
        return payService.paystatus(orderno);
    }

}
